package com.naughty.userlogin02.controller;


import com.alibaba.fastjson.JSON;
import com.naughty.userlogin02.bean.Administrator;
import com.naughty.userlogin02.dao.AdministratorDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
 **@Author:刘淑钰
 **Created on 2021/12/18
 */
@RestController
public class LoginAController {

    @Autowired
    AdministratorDao administratorDao;

    @CrossOrigin
    @RequestMapping("/logina")
    public String userLogin(@RequestBody Administrator administrator) {
        System.out.println("Administrator : " + administrator);
        String str = "error";

        int count = administratorDao.getAdminByMassage(administrator.getAname(), administrator.getApwd());

        if (count > 0) {
            str = "ok";
        }
        return str;
    }
}
